const status = [
  {
    label: '进行中',
    value: 'USER_TASK_ONGOING',
  },
  {
    label: '待核销',
    value: 'USER_TASK_TO_WRITE_OFF',
  },
  {
    label: '已核销',
    value: 'USER_TASK_WRITE_OFF',
  },
  {
    label: '已过期',
    value: 'USER_TASK_EXPIRED',
  },
];

export const formItems = [
  {
    label: '用户姓名',
    name: 'nickname',
    type: 'input',
  },
  {
    label: '手机号码',
    name: 'mobile',
    type: 'input',
  },
  {
    label: '报名状态',
    name: 'status',
    type: 'select',
    itemProps: {
      options: status,
    },
  },
  {
    label: '报名日期',
    name: 'searchRangeDate',
    valueFields: ['created_start_at', 'created_end_at'],
    valueType: 'number',
    value: [],
    type: 'range-picker',
    format: 'YYYY-MM-DD HH:mm:ss',
  },
];

export const searchRules = {
  searchName: [
    {
      required: true,
      message: 'Please input Activity name',
      trigger: 'blur',
    },
    {
      max: 15,
      message: 'Length should be max 15',
      trigger: 'blur',
    },
  ],
};

export const columns = [
  {
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
  {
    title: '用户姓名',
    dataIndex: 'nickname',
    key: 'nickname',
  },
  {
    title: '手机号码',
    dataIndex: 'mobile',
    key: 'mobile',
  },
  {
    title: '报名时间',
    dataIndex: 'create_time',
    key: 'create_time',
  },
  {
    title: '核销码',
    dataIndex: 'write_off_code',
    key: 'write_off_code',
  },
  {
    title: '核销时间',
    dataIndex: 'write_off_at',
    key: 'write_off_at',
  },
  {
    title: '完成进度',
    dataIndex: 'percent',
    key: 'percent',
    customRender(row) {
      return row.record.percent + '%';
    },
  },
  {
    title: '报名状态',
    dataIndex: 'status',
    key: 'status',
    customRender(row) {
      switch (row.record.status) {
        case 'USER_TASK_ONGOING':
          return '进行中';
        case 'USER_TASK_TO_WRITE_OFF':
          return '待核销';
        case 'USER_TASK_WRITE_OFF':
          return '已核销';
        case 'USER_TASK_EXPIRED':
          return '已过期';
      }
    },
  },
];
